﻿/*
 *GreyBox was written by Strategic Data Systems and licenced under the open source MS-PL. 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hardcodet.Wpf.TaskbarNotification;
using StrategicDataSystems.Cloud.Monitoring.UI.Resources;

namespace StrategicDataSystems.Cloud.Monitoring.UI.Services
{
    public class SysTrayNotificationService : INotificationService
    {

        private TaskbarIcon _wpfNotifyIcon;

        /// <summary>
        /// Initializes a new instance of the SysTrayNotificationService class.
        /// </summary>
        public SysTrayNotificationService(TaskbarIcon wpfNotifyIcon)
        {
            _wpfNotifyIcon = wpfNotifyIcon;
        }

        public void NotifyUserOfActiveDeployment(int activeDeploymentCount)
        {
            GreyBoxAlertNotification notifyBalloon = new GreyBoxAlertNotification();
            notifyBalloon.BalloonText = string.Format("You have {0} deployment(s).", activeDeploymentCount.ToString());
            _wpfNotifyIcon.ShowCustomBalloon(notifyBalloon, System.Windows.Controls.Primitives.PopupAnimation.Slide, 5000);
 
        }

        public void NotifyUserOfKillCommand(int activeDeploymentCount)
        {
            GreyBoxAlertNotification notifyBalloon = new GreyBoxAlertNotification();
            notifyBalloon.BalloonText = string.Format("Commands are being sent to stop {0} deployment(s).", activeDeploymentCount.ToString());
            _wpfNotifyIcon.ShowCustomBalloon(notifyBalloon, System.Windows.Controls.Primitives.PopupAnimation.Slide, 5000);
        }

        public void NotifyUserOfLostConnection()
        {
            GreyBoxAlertNotification notifyBalloon = new GreyBoxAlertNotification();
            notifyBalloon.BalloonText = "Connection to the Internet has been lost.";
            _wpfNotifyIcon.ShowCustomBalloon(notifyBalloon, System.Windows.Controls.Primitives.PopupAnimation.Slide, 5000);
        }
    }
}
